package com.nervenets.general.model;

import lombok.*;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;
import java.util.*;

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@ToString
public class SecurityUser implements Serializable {
    private long id;
    private String username;
    private String name;
    private long expireTime;//过期时间
    private HashMap<String, Object> extras = new HashMap<>();

    private List<Long> roleIds = new ArrayList<>();
    private Set<String> menus = new HashSet<>();
    private Set<String> permissions = new HashSet<>();

    public SecurityUser(long id, String username, String name) {
        this.id = id;
        this.username = username;
        this.name = name;
    }

    public void addExtra(String key, Object value) {
        this.extras.put(key, value);
    }

    public Object getExtra(String key) {
        return this.extras.get(key);
    }
}
